﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Dude.MLS
{
    [Serializable]
    public sealed class LocaleStringPair
    {
        /// <summary>
        /// Default constructor
        /// </summary>
        public LocaleStringPair()
        {
            Language = null;
            Text = "";
        }

        /// <summary>
        /// Initialize locale string pair with string without language.
        /// This have a lowest priority.
        /// </summary>
        /// <param name="text">Default language string</param>
        public LocaleStringPair(string text)
        {
            Language = null;
            Text = text;
        }

        /// <summary>
        /// Initializes locale string pair
        /// </summary>
        /// <param name="lang">language code (en, de, ...)</param>
        /// <param name="text">localized text</param>
        public LocaleStringPair(string lang, string text)
        {
            Language = lang;
            Text = text;
        }

        /// <summary>
        /// Language code (en, de, ...)
        /// </summary>
        [System.Xml.Serialization.XmlAttribute("lang")]
        public string Language { get; set; }

        /// <summary>
        /// Localized text
        /// </summary>
        [System.Xml.Serialization.XmlText]
        public string Text { get; set; }

        /// <summary>
        /// Get localized text
        /// </summary>
        /// <returns>Localized text</returns>
        public override string ToString()
        {
            return Text;
        }
    }
}
